/**
 * EditTakenCourseInfoForm class.
 */
package pits.form;

import java.util.ArrayList;
import java.util.List;

import javax.portlet.ActionRequest;

import pits.util.Errand;

public class EditTakenCourseForm {
	/**
	 * courseID.
	 */
	private int courseID;
	/**
	 * employeeID.
	 */
	private int empID;
	/**
	 * DateIssued
	 */
	private String dateIssused;
	/**
	 * Grade
	 */
	private String grade;

	/**
	 * @param request
	 */
	public EditTakenCourseForm(String txtCourseID, int empID) {
		this.courseID = Integer.parseInt(txtCourseID);
		this.empID = empID;
	}

	/**
	 * @return list of errors if exist
	 */
	public List<String> validate() {

		List<String> errorMess = new ArrayList<String>();

		if (grade == null) {
			errorMess.add("Please input the project's grade!");
		}
		return errorMess;
	}

	public void setFields(ActionRequest request) {

		Errand errand = new Errand();

		setDateIssused(errand.parseDate(request.getParameter("dateIssused")));
		// new pits.util.Logger().write(request.getParameter("dateIssused"));
		setGrade(request.getParameter("grade"));
	}

	/**
	 * @return the courseID
	 */
	public int getCourseID() {
		return courseID;
	}

	/**
	 * @param courseID
	 *            the courseID to set
	 */
	public void setCourseID(int courseID) {
		this.courseID = courseID;
	}

	/**
	 * @return the empID
	 */
	public int getEmpID() {
		return empID;
	}

	/**
	 * @param empID
	 *            the empID to set
	 */
	public void setEmpID(int empID) {
		this.empID = empID;
	}

	/**
	 * @return the dateIssused
	 */
	public String getDateIssused() {
		return dateIssused;
	}

	/**
	 * @param dateIssused
	 *            the dateIssused to set
	 */
	public void setDateIssused(String dateIssused) {
		this.dateIssused = dateIssused;
	}

	/**
	 * @return the grade
	 */
	public String getGrade() {
		return grade;
	}

	/**
	 * @param grade
	 *            the grade to set
	 */
	public void setGrade(String grade) {
		this.grade = grade;
	}
}
